home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Simulation / PDP-8 Simulator / Source Code / Assembler / Code.h < prev    next >
Encoding:
Text File  |  1992-03-16  |  3.3 KB  |  110 lines  |  [TEXT/KAHL]

  1. /************************************************************
  2. *
  3. *
  4. *    Header containing local code definitions.
  5. *
  6. *    by Adrian Bool in cooperation with Graham Cox.
  7. *
  8. *    copyright © phantasm coding 1992.
  9. *
  10. *
  11. ************************************************************/
  12.  
  13. /* private functions */
  14.  
  15. void makeMemoryInstruction(opcode , rBlock,pHandle);
  16. short thisPage(pHandle);
  17. short pageOf(addressType);
  18. addressType evaluateAddress(pHandle , char*);
  19. wordType evaluateValue(pHandle , char*);
  20. wordType evaluatePart(pHandle, char*);
  21. wordType htoi(char*);
  22. wordType otoi(char*);
  23.  
  24. /* opcode functions */
  25.  
  26. static short noOfOpcodes = 30;
  27.  
  28. void cmpAND(short,rBlock,short*,pHandle);        /* 7 basic opcode functions */
  29. void cmpTAD(short,rBlock,short*,pHandle);
  30. void cmpISZ(short,rBlock,short*,pHandle);
  31. void cmpDCA(short,rBlock,short*,pHandle);
  32. void cmpJMS(short,rBlock,short*,pHandle);
  33. void cmpJMP(short,rBlock,short*,pHandle);
  34. void cmpIO(short,rBlock,short*,pHandle);
  35.         
  36. void cmpCLL(short,rBlock,short*,pHandle);        /* 9 group one accumulator functions */        
  37. void cmpCMA(short,rBlock,short*,pHandle);                 
  38. void cmpCML(short,rBlock,short*,pHandle);
  39. void cmpIAC(short,rBlock,short*,pHandle);
  40. void cmpRAR(short,rBlock,short*,pHandle);
  41. void cmpRAL(short,rBlock,short*,pHandle);
  42. void cmpRTR(short,rBlock,short*,pHandle);
  43. void cmpRTL(short,rBlock,short*,pHandle);
  44. void cmpNOP(short,rBlock,short*,pHandle);
  45.         
  46. void cmpSMA(short,rBlock,short*,pHandle);        /* 9 group two accumualator functions */
  47. void cmpSZA(short,rBlock,short*,pHandle);
  48. void cmpSNL(short,rBlock,short*,pHandle);
  49. void cmpSPA(short,rBlock,short*,pHandle);
  50. void cmpSNA(short,rBlock,short*,pHandle);
  51. void cmpSZL(short,rBlock,short*,pHandle);
  52. void cmpCLA(short,rBlock,short*,pHandle);
  53. void cmpOSR(short,rBlock,short*,pHandle);
  54. void cmpHLT(short,rBlock,short*,pHandle);
  55.         
  56. void cmpORG(short,rBlock,short*,pHandle);        /* 5 pseudo-operations' functions */
  57. void cmpEQU(short,rBlock,short*,pHandle);
  58. void cmpEND(short,rBlock,short*,pHandle);
  59. void cmpDATA(short,rBlock,short*,pHandle);
  60. void cmpSTORE(short,rBlock,short*,pHandle);        /* total : 30 functions */ 
  61.  
  62. /* opcode table */
  63.  
  64. typedef char aMnemonic[8];
  65.  
  66. typedef struct 
  67.     {
  68.     aMnemonic mnemonic;
  69.     wordType iNumber;
  70.     void (*itsFunction)(short,rBlock,short*,pHandle);
  71.     } anOpcode;
  72.  
  73. static anOpcode pdp8[31] =
  74.         {                                        /* cmp is short for compile */
  75.             {"nul", 0, nil},
  76.             
  77.             {"and", 0, &cmpAND},                /* 7 basic opcode types */
  78.             {"tad", 1, &cmpTAD},
  79.             {"isz", 2, &cmpISZ},
  80.             {"dca", 3, &cmpDCA},
  81.             {"jms", 4, &cmpJMS},
  82.             {"jmp", 5, &cmpJMP},
  83.             {"io",  6, &cmpIO},
  84.             
  85.             {"cll", 07100, &cmpCLL},            /* 9 group one accumulator types*/
  86.             {"cma", 07040, &cmpCMA},
  87.             {"cml", 07020, &cmpCML},
  88.             {"iac", 07001, &cmpIAC},
  89.             {"rar", 07010, &cmpRAR},
  90.             {"ral", 07004, &cmpRAL},
  91.             {"rtr", 07012, &cmpRTR},
  92.             {"rtl", 07006, &cmpRTL},
  93.             {"nop", 07000, &cmpNOP},
  94.             
  95.             {"sma", 07500, &cmpSMA},            /* 9 group two accumualator types */
  96.             {"sza", 07440, &cmpSZA},
  97.             {"snl", 07420, &cmpSNL},
  98.             {"spa", 07510, &cmpSPA},
  99.             {"sna", 07450, &cmpSNA},
  100.             {"szl", 07430, &cmpSZL},
  101.             {"cla", 07600, &cmpCLA},
  102.             {"osr", 07404, &cmpOSR},
  103.             {"hlt", 07402, &cmpHLT},
  104.             
  105.             {"org", 0, &cmpORG},                /* 5 pseudo-operations */
  106.             {"equ", 0, &cmpEQU},
  107.             {"end", 0, &cmpEND},
  108.             {"data", 0, &cmpDATA},
  109.             {"store", 0, &cmpSTORE},            /* total : 30 instructions */ 
  110.         };